

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>The logger module &mdash; pyamp v1.2 documentation</title>
    <link rel="stylesheet" href="../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="top" title="pyamp v1.2 documentation" href="../index.html" />
    <link rel="up" title="The logging module" href="mod_pyamp_logging.html" />
    <link rel="next" title="The prefix module" href="pyamp_logging_prefix.html" />
    <link rel="prev" title="The colors module" href="pyamp_logging_colors.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="pyamp_logging_prefix.html" title="The prefix module"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="pyamp_logging_colors.html" title="The colors module"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">pyamp v1.2 documentation</a> &raquo;</li>
          <li><a href="mod_pyamp.html" >The pyamp module</a> &raquo;</li>
          <li><a href="mod_pyamp_logging.html" accesskey="U">The logging module</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="module-pyamp.logging.logger">
<span id="the-logger-module"></span><h1>The logger module<a class="headerlink" href="#module-pyamp.logging.logger" title="Permalink to this headline">¶</a></h1>
<p>The logger module contains the LogLevel, Logger, FileLogger, and LogData
classes.</p>
<p>These classes are focused on logging system output to various types of
output streams (e.g., console, or a file), as well as logging messages at
various different log levels.</p>
<div class="section" id="the-singlelogger-class">
<h2>The SingleLogger class<a class="headerlink" href="#the-singlelogger-class" title="Permalink to this headline">¶</a></h2>
<p class="graphviz">
<img src="../_images/inheritance-8b53674d036c802b06092a501ac7b0b6dbd8eeee.png" alt="Inheritance diagram of pyamp.logging.logger.SingleLogger" usemap="#inheritanceae2444d065" class="inheritance"/>
<map id="inheritanceae2444d065" name="inheritanceae2444d065">
<area shape="rect" href="pyamp_patterns_borg.html#pyamp.patterns.borg.Borg" title="pyamp.patterns.borg.Borg" alt="" coords="33,7,223,33"/>
<area shape="rect" href="#pyamp.logging.logger.SingleLogger" title="pyamp.logging.logger.SingleLogger" alt="" coords="5,84,251,111"/>
</map>
</p>
<dl class="class">
<dt id="pyamp.logging.logger.SingleLogger">
<em class="property">class </em><tt class="descclassname">pyamp.logging.logger.</tt><tt class="descname">SingleLogger</tt><a class="reference internal" href="../_modules/pyamp/logging/logger.html#SingleLogger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.SingleLogger" title="Permalink to this definition">¶</a></dt>
<dd><p>The SingleLogger class implements the <a class="reference internal" href="../patterns.html#pyamp.patterns.Borg" title="pyamp.patterns.Borg"><tt class="xref py py-class docutils literal"><span class="pre">pyamp.patterns.Borg</span></tt></a>
design pattern for creating a single system wide <a class="reference internal" href="#pyamp.logging.logger.Logger" title="pyamp.logging.logger.Logger"><tt class="xref py py-class docutils literal"><span class="pre">Logger</span></tt></a> object.</p>
<p>This allows an entire system to access the same <a class="reference internal" href="#pyamp.logging.logger.Logger" title="pyamp.logging.logger.Logger"><tt class="xref py py-class docutils literal"><span class="pre">Logger</span></tt></a> object so
that each component can log messages with the same data (e.g., log level,
color, prefix, etc).</p>
<p>Create the SingleLogger object.</p>
<dl class="classmethod">
<dt id="pyamp.logging.logger.SingleLogger.createFileLogger">
<em class="property">classmethod </em><tt class="descname">createFileLogger</tt><big>(</big><em>logFile</em>, <em>append=False</em>, <em>logLevel=30</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#SingleLogger.createFileLogger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.SingleLogger.createFileLogger" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a system-wide <a class="reference internal" href="#pyamp.logging.logger.FileLogger" title="pyamp.logging.logger.FileLogger"><tt class="xref py py-class docutils literal"><span class="pre">FileLogger</span></tt></a> object.</p>
<ul class="simple">
<li>logFile &#8211; The log file to use</li>
<li>append &#8211; True to append to the file, False to overwrite</li>
<li>logLevel &#8211; The log level for the logger</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.logging.logger.SingleLogger.createLogger">
<em class="property">classmethod </em><tt class="descname">createLogger</tt><big>(</big><em>name</em>, <em>logLevel=30</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#SingleLogger.createLogger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.SingleLogger.createLogger" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a system-wide <a class="reference internal" href="#pyamp.logging.logger.Logger" title="pyamp.logging.logger.Logger"><tt class="xref py py-class docutils literal"><span class="pre">Logger</span></tt></a> object.</p>
<ul class="simple">
<li>name &#8211; The name of Logger</li>
<li>logLevel &#8211; The log level for the logger</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.logging.logger.SingleLogger.critical">
<em class="property">classmethod </em><tt class="descname">critical</tt><big>(</big><em>message</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#SingleLogger.critical"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.SingleLogger.critical" title="Permalink to this definition">¶</a></dt>
<dd><p>Log the given critical message.</p>
<ul class="simple">
<li>message &#8211; The message to log</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.logging.logger.SingleLogger.debug">
<em class="property">classmethod </em><tt class="descname">debug</tt><big>(</big><em>message</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#SingleLogger.debug"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.SingleLogger.debug" title="Permalink to this definition">¶</a></dt>
<dd><p>Log the given debug message.</p>
<ul class="simple">
<li>message &#8211; The message to log</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.logging.logger.SingleLogger.error">
<em class="property">classmethod </em><tt class="descname">error</tt><big>(</big><em>message</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#SingleLogger.error"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.SingleLogger.error" title="Permalink to this definition">¶</a></dt>
<dd><p>Log the given error message.</p>
<ul class="simple">
<li>message &#8211; The message to log</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.logging.logger.SingleLogger.fatal">
<em class="property">classmethod </em><tt class="descname">fatal</tt><big>(</big><em>message</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#SingleLogger.fatal"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.SingleLogger.fatal" title="Permalink to this definition">¶</a></dt>
<dd><p>Log the given fatal message.</p>
<ul class="simple">
<li>message &#8211; The message to log</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.logging.logger.SingleLogger.getInstance">
<em class="property">classmethod </em><tt class="descname">getInstance</tt><big>(</big><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#SingleLogger.getInstance"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.SingleLogger.getInstance" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the instance of the <a class="reference internal" href="#pyamp.logging.logger.Logger" title="pyamp.logging.logger.Logger"><tt class="xref py py-class docutils literal"><span class="pre">Logger</span></tt></a> object.</p>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.logging.logger.SingleLogger.info">
<em class="property">classmethod </em><tt class="descname">info</tt><big>(</big><em>message</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#SingleLogger.info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.SingleLogger.info" title="Permalink to this definition">¶</a></dt>
<dd><p>Log the given information message.</p>
<ul class="simple">
<li>message &#8211; The message to log</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.logging.logger.SingleLogger.log">
<em class="property">classmethod </em><tt class="descname">log</tt><big>(</big><em>logLevel</em>, <em>message</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#SingleLogger.log"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.SingleLogger.log" title="Permalink to this definition">¶</a></dt>
<dd><p>Log the given message at the given log level.</p>
<ul class="simple">
<li>logLevel &#8211; The log level</li>
<li>message &#8211; The message to log</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.logging.logger.SingleLogger.warn">
<em class="property">classmethod </em><tt class="descname">warn</tt><big>(</big><em>message</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#SingleLogger.warn"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.SingleLogger.warn" title="Permalink to this definition">¶</a></dt>
<dd><p>Log the given warning message.</p>
<ul class="simple">
<li>message &#8211; The message to log</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.logging.logger.SingleLogger.warning">
<em class="property">classmethod </em><tt class="descname">warning</tt><big>(</big><em>message</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#SingleLogger.warning"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.SingleLogger.warning" title="Permalink to this definition">¶</a></dt>
<dd><p>Log the given warning message.</p>
<ul class="simple">
<li>message &#8211; The message to log</li>
</ul>
</dd></dl>

<dl class="classmethod">
<dt id="pyamp.logging.logger.SingleLogger.write">
<em class="property">classmethod </em><tt class="descname">write</tt><big>(</big><em>message</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#SingleLogger.write"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.SingleLogger.write" title="Permalink to this definition">¶</a></dt>
<dd><p>Write an information message to the logger.</p>
<ul class="simple">
<li>message &#8211; The message to write</li>
</ul>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="the-loglevel-class">
<h2>The LogLevel class<a class="headerlink" href="#the-loglevel-class" title="Permalink to this headline">¶</a></h2>
<p class="graphviz">
<img src="../_images/inheritance-53857d2b9982aa87f06524633cfa8dce7255c649.png" alt="Inheritance diagram of pyamp.logging.logger.LogLevel" usemap="#inheritance8c0f37c30a" class="inheritance"/>
<map id="inheritance8c0f37c30a" name="inheritance8c0f37c30a">
<area shape="rect" href="#pyamp.logging.logger.LogLevel" title="pyamp.logging.logger.LogLevel" alt="" coords="5,7,224,33"/>
</map>
</p>
<dl class="class">
<dt id="pyamp.logging.logger.LogLevel">
<em class="property">class </em><tt class="descclassname">pyamp.logging.logger.</tt><tt class="descname">LogLevel</tt><a class="reference internal" href="../_modules/pyamp/logging/logger.html#LogLevel"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.LogLevel" title="Permalink to this definition">¶</a></dt>
<dd><p>The LogLevel class contains definitions of all of the various log
levels that can be used for logging messages. These levels are designed
to make it easier to parse the output of a system to find different types
of issues that were encountered at runtime.</p>
<ul class="simple">
<li><strong>DEBUG</strong> &#8211; The debugging log level. Has a value of 10.</li>
<li><strong>INFO</strong> &#8211; The information log level. Has a value of 20.</li>
<li><strong>WARN</strong> &#8211; The warning log level. Has a value of 30.</li>
<li><strong>WARNING</strong> &#8211; The warning log level. Has a value of 30.</li>
<li><strong>ERROR</strong> &#8211; The error log level. Has a value of 40.</li>
<li><strong>CRITICAL</strong> &#8211; The critical log level. Has a value of 50.</li>
<li><strong>FATAL</strong> &#8211; The fatal log level. Has a value of 50.</li>
</ul>
</dd></dl>

</div>
<div class="section" id="the-prefix-class">
<h2>The Prefix class<a class="headerlink" href="#the-prefix-class" title="Permalink to this headline">¶</a></h2>
<p class="graphviz">
<img src="../_images/inheritance-33c4a90372a81a954fc78aeb6fd4ba98c4cf3748.png" alt="Inheritance diagram of pyamp.logging.logger.Prefix" usemap="#inheritance1c45daf1b3" class="inheritance"/>
<map id="inheritance1c45daf1b3" name="inheritance1c45daf1b3">
<area shape="rect" href="pyamp_logging_prefix.html#pyamp.logging.prefix.Prefix" title="pyamp.logging.prefix.Prefix" alt="" coords="5,7,197,33"/>
</map>
</p>
<dl class="class">
<dt id="pyamp.logging.logger.Prefix">
<em class="property">class </em><tt class="descclassname">pyamp.logging.logger.</tt><tt class="descname">Prefix</tt><big>(</big><em>text=None</em>, <em>color=0</em>, <em>prefix=None</em><big>)</big><a class="headerlink" href="#pyamp.logging.logger.Prefix" title="Permalink to this definition">¶</a></dt>
<dd><p>The Prefix class provides the ability to add chain of prefixes to a
message. A Prefix contains text which is printed in square brackets
before the given message. The following shows an example of the a
Prefix for the string &#8220;DEBUG&#8221;.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">prefix</span> <span class="o">=</span> <span class="n">Prefix</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">&quot;DEBUG&quot;</span><span class="p">)</span>

<span class="c"># Prints: [DEBUG]: This is the message</span>
<span class="n">prefix</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="s">&quot;This is the message&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>A Prefix can be colored, and it can contain other prefixes which are
appended to the message before adding the current Prefix.</p>
<p>An example of multiple prefixes:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">debugPrefix</span> <span class="o">=</span> <span class="n">Prefix</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">&quot;DEBUG&quot;</span><span class="p">)</span>
<span class="n">examplePrefix</span> <span class="o">=</span> <span class="n">Prefix</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">&quot;example&quot;</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="n">debugPrefix</span><span class="p">)</span>
<span class="n">datePrefix</span> <span class="o">=</span> <span class="n">Prefix</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">&quot;03/11/2012&quot;</span><span class="p">,</span> <span class="n">prefix</span><span class="o">=</span><span class="n">examplePrefix</span><span class="p">)</span>

<span class="c"># Prints: [DEBUG]: [example]: [03/11/2012]: This is the message</span>
<span class="n">datePrefix</span><span class="o">.</span><span class="n">apply</span><span class="p">(</span><span class="s">&quot;This is the message&quot;</span><span class="p">)</span>
</pre></div>
</div>
<ul class="simple">
<li>text &#8211; The text to display in the Prefix</li>
<li>color &#8211; The color in which the Prefix will be displayed</li>
<li>prefix &#8211; The next Prefix in the chain</li>
</ul>
<dl class="method">
<dt id="pyamp.logging.logger.Prefix.apply">
<tt class="descname">apply</tt><big>(</big><em>message</em>, <em>useColors=False</em><big>)</big><a class="headerlink" href="#pyamp.logging.logger.Prefix.apply" title="Permalink to this definition">¶</a></dt>
<dd><p>Apply the chain of Prefixes to the given message.</p>
<ul class="simple">
<li>message &#8211; The message to apply the Prefix chain to</li>
<li>useColors &#8211; True to use colors, False otherwise</li>
</ul>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="the-logdata-class">
<h2>The LogData class<a class="headerlink" href="#the-logdata-class" title="Permalink to this headline">¶</a></h2>
<p class="graphviz">
<img src="../_images/inheritance-8f920a5ae76e768b1124f0229e68ff6b661a662c.png" alt="Inheritance diagram of pyamp.logging.logger.LogData" usemap="#inheritance513e751516" class="inheritance"/>
<map id="inheritance513e751516" name="inheritance513e751516">
<area shape="rect" href="#pyamp.logging.logger.LogData" title="pyamp.logging.logger.LogData" alt="" coords="5,7,221,33"/>
</map>
</p>
<dl class="class">
<dt id="pyamp.logging.logger.LogData">
<em class="property">class </em><tt class="descclassname">pyamp.logging.logger.</tt><tt class="descname">LogData</tt><big>(</big><em>logLevel=20</em>, <em>debugLevel=0</em>, <em>prefix=&lt;pyamp.logging.prefix.Prefix instance at 0x957a32c&gt;</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#LogData"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.LogData" title="Permalink to this definition">¶</a></dt>
<dd><p>The LogData class provides the ability to store logging data for an
entire system in an object that can be easily handled.</p>
<p>The LogData class stores a <a class="reference internal" href="#pyamp.logging.logger.LogLevel" title="pyamp.logging.logger.LogLevel"><tt class="xref py py-class docutils literal"><span class="pre">LogLevel</span></tt></a> and an integer debug level
for a system, and provides the ability to create a named <a class="reference internal" href="#pyamp.logging.logger.Logger" title="pyamp.logging.logger.Logger"><tt class="xref py py-class docutils literal"><span class="pre">Logger</span></tt></a>
from the stored values.</p>
<p>For example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># Any Logger objects created from this LogData object will have a</span>
<span class="c"># LogLevel of DEBUG, and a debug level of 10.</span>
<span class="n">logData</span> <span class="o">=</span> <span class="n">LogData</span><span class="p">(</span><span class="n">LogLevel</span><span class="o">.</span><span class="n">DEBUG</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>

<span class="c"># Create a logger named &#39;ExampleLogger&#39; which will log messages</span>
<span class="c"># with a red foreground color.</span>
<span class="n">logger</span> <span class="o">=</span> <span class="n">logData</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">&quot;ExampleLogger&quot;</span><span class="p">,</span> <span class="n">Colors</span><span class="o">.</span><span class="n">Foreground</span><span class="o">.</span><span class="n">Red</span><span class="p">)</span>

<span class="c"># This message will be displayed</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&quot;Example message&quot;</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>

<span class="c"># This message will not be displayed</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&quot;Example message&quot;</span><span class="p">,</span> <span class="mi">11</span><span class="p">)</span>
</pre></div>
</div>
<p>LogData objects can be easily passed around which allows the
:class::<cite>LogLevel</cite> and debug level values to be easily propagated
throughout the system, rather than having individual values for each
system component.</p>
<ul class="simple">
<li>logLevel &#8211; The log level</li>
<li>debugLevel &#8211; The debug level</li>
<li>prefix &#8211; The prefix chain to use for all loggers</li>
</ul>
<dl class="method">
<dt id="pyamp.logging.logger.LogData.get">
<tt class="descname">get</tt><big>(</big><em>name=None</em>, <em>color=0</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#LogData.get"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.LogData.get" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a new Logger with the given name.</p>
<ul class="simple">
<li>name &#8211; The name to assign the Logger</li>
<li>color &#8211; The color to use for the Logger</li>
</ul>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="the-colors-class">
<h2>The Colors class<a class="headerlink" href="#the-colors-class" title="Permalink to this headline">¶</a></h2>
<p class="graphviz">
<img src="../_images/inheritance-45704f3de1de778883d0e92d13c6d9ab6ad93231.png" alt="Inheritance diagram of pyamp.logging.logger.Colors" usemap="#inheritance79bcd27066" class="inheritance"/>
<map id="inheritance79bcd27066" name="inheritance79bcd27066">
<area shape="rect" href="pyamp_logging_colors.html#pyamp.logging.colors.Colors" title="pyamp.logging.colors.Colors" alt="" coords="5,7,205,33"/>
</map>
</p>
<dl class="class">
<dt id="pyamp.logging.logger.Colors">
<em class="property">class </em><tt class="descclassname">pyamp.logging.logger.</tt><tt class="descname">Colors</tt><a class="headerlink" href="#pyamp.logging.logger.Colors" title="Permalink to this definition">¶</a></dt>
<dd><p>The Colors class contains two classes which define possible Foreground
and Background colors. These colors can be used to colorize console output
in a specific way.</p>
<dl class="class">
<dt id="pyamp.logging.logger.Colors.Background">
<em class="property">class </em><tt class="descname">Background</tt><a class="headerlink" href="#pyamp.logging.logger.Colors.Background" title="Permalink to this definition">¶</a></dt>
<dd><p>The Background class contains definitions of the following
background colors.</p>
<ul class="simple">
<li><em>White_Bold_Underline</em></li>
<li><em>Blue</em>, and <em>Light_Blue</em></li>
<li><em>Purple</em>, and <em>Light_Purple</em></li>
<li><em>Green</em>, and <em>Light_Green</em></li>
<li><em>Red</em>, and <em>Light_Red</em></li>
<li><em>Gray</em>, and <em>Light_Gray</em></li>
<li><em>Cyan</em>, and <em>Light_Cyan</em></li>
<li><em>Orange</em>, and <em>Light_Yellow</em></li>
</ul>
</dd></dl>

<dl class="class">
<dt id="pyamp.logging.logger.Colors.Foreground">
<em class="property">class </em><tt class="descclassname">Colors.</tt><tt class="descname">Foreground</tt><a class="headerlink" href="#pyamp.logging.logger.Colors.Foreground" title="Permalink to this definition">¶</a></dt>
<dd><p>The Foreground class contains definitions of the following
foreground colors.</p>
<ul class="simple">
<li><em>White</em></li>
<li><em>White_Bold</em></li>
<li><em>White_Underline</em></li>
<li><em>Black</em></li>
<li><em>Blue</em>, and <em>Light_Blue</em></li>
<li><em>Purple</em>, and <em>Light_Purple</em></li>
<li><em>Green</em>, and <em>Light_Green</em></li>
<li><em>Red</em>, and <em>Light_Red</em></li>
<li><em>Gray</em>, and <em>Light_Gray</em></li>
<li><em>Cyan</em>, and <em>Light_Cyan</em></li>
<li><em>Orange</em>, and <em>Light_Yellow</em></li>
</ul>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="the-filelogger-class">
<h2>The FileLogger class<a class="headerlink" href="#the-filelogger-class" title="Permalink to this headline">¶</a></h2>
<p class="graphviz">
<img src="../_images/inheritance-e92e34884986d3ed1460913f66dd390673d5a430.png" alt="Inheritance diagram of pyamp.logging.logger.FileLogger" usemap="#inheritancee7fb2ee2cf" class="inheritance"/>
<map id="inheritancee7fb2ee2cf" name="inheritancee7fb2ee2cf">
<area shape="rect" href="#pyamp.logging.logger.Logger" title="pyamp.logging.logger.Logger" alt="" coords="16,161,221,188"/>
<area shape="rect" href="#pyamp.logging.logger.FileLogger" title="pyamp.logging.logger.FileLogger" alt="" coords="5,239,232,265"/>
</map>
</p>
<dl class="class">
<dt id="pyamp.logging.logger.FileLogger">
<em class="property">class </em><tt class="descclassname">pyamp.logging.logger.</tt><tt class="descname">FileLogger</tt><big>(</big><em>filename</em>, <em>append=True</em>, <em>name=None</em>, <em>prefix=&lt;pyamp.logging.prefix.Prefix instance at 0x957a08c&gt;</em>, <em>logLevel=30</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#FileLogger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.FileLogger" title="Permalink to this definition">¶</a></dt>
<dd><p>The FileLogger class provides a wrapper class for a
<a class="reference internal" href="#pyamp.logging.logger.Logger" title="pyamp.logging.logger.Logger"><tt class="xref py py-class docutils literal"><span class="pre">Logger</span></tt></a> object which outputs its messages to a specified
file. When creating the FileLogger, it can be specified whether existing
files should be overwritten, or appended to, when messages are initially
logged to the file.</p>
<ul class="simple">
<li>filename &#8211; The file which will be logged to</li>
<li>overwrite &#8211; True to append to the log file, False to overwrite</li>
<li>name &#8211; The name of the Logger</li>
<li>prefix &#8211; The <a class="reference internal" href="#pyamp.logging.logger.Prefix" title="pyamp.logging.logger.Prefix"><tt class="xref py py-class docutils literal"><span class="pre">Prefix</span></tt></a> chain to use for this FileLogger</li>
<li>logLevel &#8211; The log level to use for this FileLogger</li>
</ul>
</dd></dl>

</div>
<div class="section" id="the-logger-class">
<h2>The Logger class<a class="headerlink" href="#the-logger-class" title="Permalink to this headline">¶</a></h2>
<p class="graphviz">
<img src="../_images/inheritance-f6470aff9d1f926db5b71c003b15ee52595f6c0c.png" alt="Inheritance diagram of pyamp.logging.logger.Logger" usemap="#inheritance736fd88f7e" class="inheritance"/>
<map id="inheritance736fd88f7e" name="inheritance736fd88f7e">
<area shape="rect" href="#pyamp.logging.logger.Logger" title="pyamp.logging.logger.Logger" alt="" coords="5,161,211,188"/>
</map>
</p>
<dl class="class">
<dt id="pyamp.logging.logger.Logger">
<em class="property">class </em><tt class="descclassname">pyamp.logging.logger.</tt><tt class="descname">Logger</tt><big>(</big><em>name=None</em>, <em>color=0</em>, <em>prefix=&lt;pyamp.logging.prefix.Prefix instance at 0x957d32c&gt;</em>, <em>logLevel=30</em>, <em>debugLevel=0</em>, <em>handler=&lt;logging.StreamHandler instance at 0x957af2c&gt;</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#Logger"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.Logger" title="Permalink to this definition">¶</a></dt>
<dd><p>The Logger class provides the ability to log various types
of messages to a specific stream, and formats the messages using given
<a class="reference internal" href="#pyamp.logging.logger.Prefix" title="pyamp.logging.logger.Prefix"><tt class="xref py py-class docutils literal"><span class="pre">Prefix</span></tt></a> objects.</p>
<p>The Logger class will log each <a class="reference internal" href="#pyamp.logging.logger.LogLevel" title="pyamp.logging.logger.LogLevel"><tt class="xref py py-class docutils literal"><span class="pre">LogLevel</span></tt></a> with a colored
prefix indicating the name of the log level. Logged messages are only
displayed in the event that the <a class="reference internal" href="#pyamp.logging.logger.LogLevel" title="pyamp.logging.logger.LogLevel"><tt class="xref py py-class docutils literal"><span class="pre">LogLevel</span></tt></a> at which they are
logged is greater than or equal to the current <a class="reference internal" href="#pyamp.logging.logger.LogLevel" title="pyamp.logging.logger.LogLevel"><tt class="xref py py-class docutils literal"><span class="pre">LogLevel</span></tt></a> of the
Logger which is logging the message. Each <tt class="xref py py-class docutils literal"><span class="pre">LogLevel.DEBUG</span></tt>
message can also have an optional debug level specified, which will allow
that message to be displayed so long as the specified debug level is less
than or equal to the configured debug level of the Logger object.</p>
<p>Each Logger object can be named, and colored, which means that
any message logged using that object will be displayed with a prefix
indicating the name (and displayed in the specified color) of the object
which logged the message.</p>
<p>Logger objects can be given a chain of <a class="reference internal" href="#pyamp.logging.logger.Prefix" title="pyamp.logging.logger.Prefix"><tt class="xref py py-class docutils literal"><span class="pre">Prefix</span></tt></a> objects.
Any message logged using that Logger object will then have a
series of prefixes added to the front of the message.</p>
<p>Logger objects can also have a handler specified, which specifies
the type of stream which will be handled by this Logger. For
example, to output to the console a value of <a class="reference external" href="http://docs.python.org/library/logging.handlers.html#logging.StreamHandler" title="(in Python v2.7)"><tt class="docutils literal"><span class="pre">logging.StreamHandler</span></tt></a>
could be specified, whereas a value of <a class="reference external" href="http://docs.python.org/library/logging.handlers.html#logging.FileHandler" title="(in Python v2.7)"><tt class="docutils literal"><span class="pre">logging.FileHandler</span></tt></a> could
be specified to log to a specific file.</p>
<p>Example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="c"># Create a Logger with the name &#39;Example1&#39;</span>
<span class="n">logger</span> <span class="o">=</span> <span class="n">Logger</span><span class="p">(</span><span class="s">&quot;Example1&quot;</span><span class="p">)</span>
<span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s">&quot;Information message&quot;</span><span class="p">)</span>

<span class="c"># Create a Logger with the name &#39;Example2&#39;, a foreground</span>
<span class="c"># color of Blue, and logs DEBUG messages that have a debug</span>
<span class="c"># level less than or equal to 10.</span>
<span class="n">logger</span> <span class="o">=</span> <span class="n">Logger</span><span class="p">(</span><span class="s">&quot;Example2&quot;</span><span class="p">,</span> <span class="n">color</span><span class="o">=</span><span class="n">Colors</span><span class="o">.</span><span class="n">Foreground</span><span class="o">.</span><span class="n">Blue</span><span class="p">,</span>
                <span class="n">logLevel</span><span class="o">=</span><span class="n">LogLevel</span><span class="o">.</span><span class="n">DEBUG</span><span class="p">,</span> <span class="n">debugLevel</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&quot;This message is displayed&quot;</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
<span class="n">logger</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="s">&quot;This message is not displayed&quot;</span><span class="p">,</span> <span class="mi">11</span><span class="p">)</span>

<span class="c"># Create a Logger with the name &#39;Example3&#39; that only displays</span>
<span class="c"># ERROR messages</span>
<span class="n">logger</span> <span class="o">=</span> <span class="n">Logger</span><span class="p">(</span><span class="s">&quot;Example3&quot;</span><span class="p">,</span> <span class="n">logLevel</span><span class="o">=</span><span class="n">LogLevel</span><span class="o">.</span><span class="n">ERROR</span><span class="p">)</span>
<span class="n">logger</span><span class="o">.</span><span class="n">warn</span><span class="p">(</span><span class="s">&quot;This would not be displayed&quot;</span><span class="p">)</span>
</pre></div>
</div>
<ul class="simple">
<li>name &#8211; The name of the Logger</li>
<li>color &#8211; The color to use for this Logger</li>
<li>prefix &#8211; The <a class="reference internal" href="#pyamp.logging.logger.Prefix" title="pyamp.logging.logger.Prefix"><tt class="xref py py-class docutils literal"><span class="pre">Prefix</span></tt></a> chain to use for this Logger</li>
<li>logLevel &#8211; The log level to use for this Logger</li>
<li>debugLevel &#8211; The debug level</li>
<li>handler &#8211; The handler to use for this Logger</li>
</ul>
<dl class="method">
<dt id="pyamp.logging.logger.Logger.critical">
<tt class="descname">critical</tt><big>(</big><em>message</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#Logger.critical"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.Logger.critical" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a critical message.</p>
<ul class="simple">
<li>message &#8211; The message to log</li>
<li>args &#8211; The arguments</li>
<li>kwargs &#8211; The keyword arguments</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.logging.logger.Logger.debug">
<tt class="descname">debug</tt><big>(</big><em>message</em>, <em>level=0</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#Logger.debug"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.Logger.debug" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a debug message.</p>
<ul class="simple">
<li>message &#8211; The message to log</li>
<li>level &#8211; The debug level</li>
<li>args &#8211; The arguments</li>
<li>kwargs &#8211; The keyword arguments</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.logging.logger.Logger.error">
<tt class="descname">error</tt><big>(</big><em>message</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#Logger.error"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.Logger.error" title="Permalink to this definition">¶</a></dt>
<dd><p>Log an error message.</p>
<ul class="simple">
<li>message &#8211; The message to log</li>
<li>args &#8211; The arguments</li>
<li>kwargs &#8211; The keyword arguments</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.logging.logger.Logger.fatal">
<tt class="descname">fatal</tt><big>(</big><em>message</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#Logger.fatal"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.Logger.fatal" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a fatal message.</p>
<ul class="simple">
<li>message &#8211; The message to log</li>
<li>args &#8211; The arguments</li>
<li>kwargs &#8211; The keyword arguments</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.logging.logger.Logger.info">
<tt class="descname">info</tt><big>(</big><em>message</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#Logger.info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.Logger.info" title="Permalink to this definition">¶</a></dt>
<dd><p>Log an info message.</p>
<ul class="simple">
<li>message &#8211; The message to log</li>
<li>args &#8211; The arguments</li>
<li>kwargs &#8211; The keyword arguments</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.logging.logger.Logger.log">
<tt class="descname">log</tt><big>(</big><em>logLevel</em>, <em>message</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#Logger.log"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.Logger.log" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a message at the given log level.</p>
<ul class="simple">
<li>logLevel &#8211; The level at which to log</li>
<li>message &#8211; The message to log</li>
<li>args &#8211; The arguments</li>
<li>kwargs &#8211; The keyword arguments</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.logging.logger.Logger.setName">
<tt class="descname">setName</tt><big>(</big><em>name</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#Logger.setName"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.Logger.setName" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the name for this logger.</p>
<ul class="simple">
<li>name &#8211; The name</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.logging.logger.Logger.setPrefix">
<tt class="descname">setPrefix</tt><big>(</big><em>prefix</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#Logger.setPrefix"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.Logger.setPrefix" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the prefix for this logger.</p>
<ul class="simple">
<li>prefix &#8211; The prefix</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.logging.logger.Logger.warn">
<tt class="descname">warn</tt><big>(</big><em>message</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#Logger.warn"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.Logger.warn" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a warning message.</p>
<ul class="simple">
<li>message &#8211; The message to log</li>
<li>args &#8211; The arguments</li>
<li>kwargs &#8211; The keyword arguments</li>
</ul>
</dd></dl>

<dl class="method">
<dt id="pyamp.logging.logger.Logger.warning">
<tt class="descname">warning</tt><big>(</big><em>message</em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="reference internal" href="../_modules/pyamp/logging/logger.html#Logger.warning"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#pyamp.logging.logger.Logger.warning" title="Permalink to this definition">¶</a></dt>
<dd><p>Log a warning message.</p>
<ul class="simple">
<li>message &#8211; The message to log</li>
<li>args &#8211; The arguments</li>
<li>kwargs &#8211; The keyword arguments</li>
</ul>
</dd></dl>

</dd></dl>

</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">The logger module</a><ul>
<li><a class="reference internal" href="#the-singlelogger-class">The SingleLogger class</a></li>
<li><a class="reference internal" href="#the-loglevel-class">The LogLevel class</a></li>
<li><a class="reference internal" href="#the-prefix-class">The Prefix class</a></li>
<li><a class="reference internal" href="#the-logdata-class">The LogData class</a></li>
<li><a class="reference internal" href="#the-colors-class">The Colors class</a></li>
<li><a class="reference internal" href="#the-filelogger-class">The FileLogger class</a></li>
<li><a class="reference internal" href="#the-logger-class">The Logger class</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="pyamp_logging_colors.html"
                        title="previous chapter">The colors module</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="pyamp_logging_prefix.html"
                        title="next chapter">The prefix module</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../_sources/_generated/pyamp_logging_logger.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" size="18" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="pyamp_logging_prefix.html" title="The prefix module"
             >next</a> |</li>
        <li class="right" >
          <a href="pyamp_logging_colors.html" title="The colors module"
             >previous</a> |</li>
        <li><a href="../index.html">pyamp v1.2 documentation</a> &raquo;</li>
          <li><a href="mod_pyamp.html" >The pyamp module</a> &raquo;</li>
          <li><a href="mod_pyamp_logging.html" >The logging module</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2012, Brett Ponsler.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.1.
    </div>
  </body>
</html>